﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace _0712502_0712504_DesignPatternGame
{
    public class UserControlledTankManager
    {
        static public UserControlledTank _tankLevel;
        public bool IsFinished = false;
            
        public UserControlledTank TankLevel
        {
            get { return _tankLevel; }
            set { _tankLevel = value; }
        }

        public UserControlledTankManager()
        {
            _tankLevel = new UserControlledTankLevel1(this);
        }

        public void Initilize()
        {         
            _tankLevel.Initialize();
           
        }

        public void DrawToScreen(GameTime gameTime, SpriteBatch spriteBatch)
        {
            _tankLevel.DrawToScreen(gameTime, spriteBatch);
        }

        public void Update(GameTime gameTime)
        {
           
            _tankLevel.TankUpdate(gameTime);

            if (_tankLevel.StateUsed == StateInUse.NotUsed)
            {
                if (_tankLevel.Life > 0)
                {
                    ReProducePlayerTank();
                }
                else
                {
                    //IsFinished = true;
                }
            }            
        }

        public void ReProducePlayerTank()
        {
            _tankLevel.Life += 1;
            _tankLevel.StateUsed = StateInUse.Using;
            _tankLevel.CurrentHP = 500;
            _tankLevel.Position = new Vector2(200, 200);
        }
        
    }
}
